<template>
    <van-nav-bar
        title="物流详情"
        left-text="返回"
        left-arrow
        @click-left="back"
    />

    <!-- 联系人 -->
    <van-contact-card type="edit" :tel="mobile" :name="nickname" :editable="false" />
    <van-steps direction="vertical" :active="0">
        <van-step v-for="item in list">
            <h3>{{ item.AcceptStation }}</h3>
            <p>{{item.AcceptTime}}</p>
        </van-step>
    </van-steps>


</template>

<script setup>
    import {getCurrentInstance} from 'vue'  
    const {proxy}  = getCurrentInstance()

    var business = reactive(proxy.$cookies.get('business'))
    var orderid = proxy.$route.query.orderid ? proxy.$route.query.orderid : 0
    orderid = ref(orderid)

    // 物流信息
    var list = ref([])
    var nickname = ref('')
    var mobile = ref('')

    // 钩子函数
    onBeforeMount(() => {
        ExpressData()
    })

    const back = () => {
        proxy.$router.go(-1)
        return false
    }

    // 请求列表
    let ExpressData = async () => {
        // 封装数据
        var data =  {
            busid: business.id,
            orderid: orderid.value
        }

        var result = await proxy.$POST({
            url: '/order/express',
            params: data
        })

        if(result.data == 0) {
            proxy.$fail(result.msg)
            return false
        }

        nickname.value = result.data.nickname
        mobile.value = result.data.mobile
        list.value = result.data.list.reverse()
    }

</script>